﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CoreUtils.WIL
{
    public class Region
    {
        public static FVIL.Data.CFviImage cropImage(FVIL.Data.CFviImage src, System.Drawing.Rectangle rect)
        {
            FVIL.Data.CFviPattern pattern = new FVIL.Data.CFviPattern();
            FVIL.Data.CFviPoint mark = new FVIL.Data.CFviPoint();
            mark.X = Convert.ToDouble(rect.X);
            mark.Y = Convert.ToDouble(rect.Y);
            FVIL.Data.CFviRectangle rect2 = new FVIL.Data.CFviRectangle(rect.Left, rect.Top, rect.Right, rect.Bottom);
            try
            {
                pattern.MakePattern(src, rect2, mark);
            }
            catch (System.Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return pattern;
        }
    }
}
